﻿
    using System;
    using System.IO;
    using System.Runtime.Serialization.Json;
    using System.Text;
    namespace WCYCReader.Main.Core
{
    public class ParseJson
    {
        private static T _parse<T>(Stream stream)
        {
            return (T) new DataContractJsonSerializer(typeof(T)).ReadObject(stream);
        }

        public static T Parse<T>(string json)
        {
            MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(json));
            return _parse<T>(stream);
        }
    }
}

